import { NextRequest, NextResponse } from "next/server";
import { getSession } from "@/lib/session";

export default async function middleware(req: NextRequest) {
  const session = await getSession();
  console.log(session,"获取seesion");
  if (!session || !session.user)
    return NextResponse.redirect(new URL("/auth/signin", req.nextUrl));

  return NextResponse.next();
}

export const config = {
  matcher: ["/profile", "/dashboard", "/dashboard/:path*", "/"],
};